import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import Component from '@/components' //导入注册组件
import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import Print from 'vue-print-nb'

import '@/icons' // icon
import '@/permission' // permission control
Vue.use(Print); //注册打印指令
/**
 * 把directives全部引入
 * 然后把directives封装数组
 * 遍历数组提取数组key value
 * 注册自定义事件directives内的自定义事件(内目前只有一个imgerror自定义事件)
 * **/
import * as directives from "@/directives"
import * as filters from "@/filters" //引入所有过滤方法
Object.keys(directives).forEach(key => {
        Vue.directive(key, directives[key])
    })
    // 注册fitlers
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key])
})


// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
    // 如果想要中文版 element-ui，按如下方式声明
    // Vue.use(ElementUI)
Vue.use(Component)
Vue.config.productionTip = false

new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})